﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="VolInfo.aspx.cs" Inherits="Volunteer._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    void ValidateTDate(object sender, ServerValidateEventArgs args)
    {
        try
        {
            DateTime result;
            if (System.DateTime.TryParse(args.Value,out result))
            { args.IsValid = true; }
            else
            { args.IsValid = false; }
        }
        catch(Exception ex)
        {
            string strMessage = ex.Message;
            args.IsValid = false;
        }
    }

    void ValidatePhone(object sender, ServerValidateEventArgs args)
    {
        try
        {
            Regex rgx = new Regex(@"^\(?\d{3}\)?.? ?\d{3}\.?\-?\d{4}$");
            if (rgx.IsMatch(args.Value) || string.IsNullOrEmpty(args.Value))
            { args.IsValid = true; }
            else
            { args.IsValid = false; }
        }
        catch (Exception ex)
        {
            string strMessage = ex.Message;
            args.IsValid = false;
        }
    }
</script>
    
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Volunteer Info Page</title>
        
</head>
<body>
    <form id="form1" runat="server">
    <asp:Panel ID="Panel1" runat="server" BackColor="#339966" BorderColor="#CCCCCC" 
        Height="73px" style="margin-left: 0px; margin-top: 0px" Width="793px">
        <div>
        </div>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <br />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <b>BATTERED 
        WOMEN&#39;S NETWORK<br />
        <br />
        </b>
        
        <asp:Panel ID="Panel3" runat="server" Height="691px" 
            style="margin-top: 0px; margin-left: 172px;" Width="622px">
            &nbsp;&nbsp;&nbsp;&nbsp;
            <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <div style="left: 10px; position:relative; height: 655px; top: 0px; width: 613px;">
                <asp:Table runat="server" Width="99%">
                    <asp:TableHeaderRow>
                        <asp:TableHeaderCell>Please fill in the Volunteer Information:</asp:TableHeaderCell>
                    </asp:TableHeaderRow>
                    <asp:TableRow>
                        <asp:TableCell>
                        <label for="ddlTitle">
                        Title:
                        </label>
                        <asp:DropDownList ID="ddlTitle" runat="server" DataSourceID="dsTitle" DataTextField="Title" DataValueField="Title" />
                        </asp:TableCell>
                        <asp:TableCell>
                        <br />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell>
                        <label for="txtFName">
                        First Name:
                        </label>
                        <asp:TextBox ID="txtFName" runat="server" MaxLength="30" />
                        <asp:RequiredFieldValidator ID="rfvFName" runat="server" 
                            ControlToValidate="txtFName" ErrorMessage="First Name cannot be blank!" 
                            Text="*" />
                        <asp:RegularExpressionValidator ID="revFName" runat="server" 
                            ControlToValidate="txtFName" 
                            ErrorMessage="First Name has to be non-numeric and without white spaces!" 
                            Text="*" ValidationExpression="^\w\S\D*$" />
                        </asp:TableCell>
                        <asp:TableCell>
                        <label for="txtEmail">
                        Email:
                        </label>
                        <asp:TextBox ID="txtEmail" runat="server" MaxLength="80" />
                        <asp:RequiredFieldValidator ID="rfvEmail" runat="server" 
                            ControlToValidate="txtEmail" ErrorMessage="Email cannot be blank!" Text="*" />
                        <asp:RegularExpressionValidator ID="revEmail" runat="server" 
                            ControlToValidate="txtEmail" ErrorMessage="Incorrect Email!" Text="*" 
                            ValidationExpression="^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell>
                        <label for="txtLName">
                        Last Name:
                        </label>
                        <asp:TextBox ID="txtLName" runat="server" MaxLength="50" />
                        <asp:RequiredFieldValidator ID="rfvLName" runat="server" 
                            ControlToValidate="txtLName" ErrorMessage="Last Name cannot be blank!" 
                            Text="*" />
                        <asp:RegularExpressionValidator ID="revLName" runat="server" 
                            ControlToValidate="txtLName" 
                            ErrorMessage="Last Name has to be non-numeric and without white spaces!" 
                            Text="*" ValidationExpression="^\w\S\D*$" />
                        </asp:TableCell>
                        <asp:TableCell>
                        <label for="txtFax">
                        Fax:
                        </label>
                        <asp:TextBox ID="txtFax" runat="server" />
                        <asp:CustomValidator ID="cvFax" runat="server" ControlToValidate="txtFax" 
                            ErrorMessage="Fax has to be either blank or in a valid phone number format (xxx.xxx.xxxx)" 
                            OnServerValidate="ValidatePhone" Text="*" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell>
                        <label for="txtDOB">
                        Date of Birth:
                        </label>
                        <asp:TextBox ID="txtDOB" runat="server" />
                        <asp:RequiredFieldValidator ID="rfvDOB" runat="server" 
                            ControlToValidate="txtDOB" ErrorMessage="Date of Birth cannot be blank!" 
                            Text="*" />
                        <asp:CompareValidator ID="cvDOB" runat="server" ControlToValidate="txtDOB" 
                            ErrorMessage="Please enter a valid Date of Birth." Operator="DataTypeCheck" 
                            Text="*" Type="Date" />
                        </asp:TableCell>
                        <asp:TableCell>
                        <label for="txtWPhone">
                        Work Phone:
                        </label>
                        <asp:TextBox ID="txtWPhone" runat="server" />
                        <asp:CustomValidator ID="CustomValidator2" runat="server" ControlToValidate="txtWPhone" 
                            ErrorMessage="Work Phone has to be either blank or in a valid phone number format (xxx.xxx.xxxx)" 
                            OnServerValidate="ValidatePhone" Text="*" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell>
                        <label for="txtHDate">
                        Hire Date:
                        </label>
                        <asp:TextBox ID="txtHDate" runat="server" />
                        <asp:RequiredFieldValidator ID="rfvHDate" runat="server" 
                            ControlToValidate="txtHDate" ErrorMessage="Hire Date cannot be blank!" 
                            Text="*" />
                        <asp:CompareValidator ID="cvHDate" runat="server" ControlToValidate="txtHDate" 
                            ErrorMessage="Please enter a valid Hire Date." Operator="DataTypeCheck" 
                            Text="*" Type="Date" />
                        </asp:TableCell>
                        <asp:TableCell>
                        <label for="txtHPhone">
                        Home Phone:
                        </label>
                        <asp:TextBox ID="txtHPhone" runat="server" />
                        <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="txtHPhone" 
                            ErrorMessage="Home Phone has to be either blank or in a valid phone number format (xxx.xxx.xxxx)" 
                            OnServerValidate="ValidatePhone" Text="*" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell>
                        <label for="txtTDate">
                        Term Date:
                        </label>
                        <asp:TextBox ID="txtTDate" runat="server" />
                        <asp:CustomValidator ID="custvDate" runat="server" ControlToValidate="txtTDate" 
                            ErrorMessage="Term Date has to be either blank or in a valid date format (mm-dd-yyyy)" 
                            OnServerValidate="ValidateTDate" Text="*" />
                        </asp:TableCell>
                        <asp:TableCell>
                        <label for="txtCPhone">
                        Cell Phone:
                        </label>
                        <asp:TextBox ID="txtCPhone" runat="server" />
                        <asp:CustomValidator ID="cvCPhone" runat="server" ControlToValidate="txtCPhone" 
                            ErrorMessage="Cell Phone has to be either blank or in a valid phone number format (xxx.xxx.xxxx)" 
                            OnServerValidate="ValidatePhone" Text="*" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell>
                        <label for="txtAddress">
                        Address:
                        </label>
                        <asp:TextBox ID="txtAddress" runat="server" />
                        <asp:RequiredFieldValidator ID="rfvAddress" runat="server" 
                            ControlToValidate="txtAddress" ErrorMessage="Incorrect Address!" Text="*" />
                        </asp:TableCell>
                        <asp:TableCell>
                        <label for="txtState">
                        State:
                        </label>
                        <asp:TextBox ID="txtState" runat="server" />
                        <asp:RequiredFieldValidator ID="rfvState" runat="server" 
                            ControlToValidate="txtState" ErrorMessage="State cannot be blank!" Text="*" />
                        <asp:RegularExpressionValidator ID="revState" runat="server" 
                            ControlToValidate="txtState" ErrorMessage="Incorrect State!" Text="*" 
                            ValidationExpression="^\w\S\D*$" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell>
                        <label for="txtCity">
                        City:
                        </label>
                        <asp:TextBox ID="txtCity" runat="server" />
                        <asp:RequiredFieldValidator ID="rfvCity" runat="server" 
                            ControlToValidate="txtCity" ErrorMessage="City cannot be blank!" Text="*" />
                        <asp:RegularExpressionValidator ID="revCity" runat="server" 
                            ControlToValidate="txtCity" ErrorMessage="Incorrect City!" Text="*" 
                            ValidationExpression="^\w\S\D*$" />
                        </asp:TableCell>
                        <asp:TableCell>
                        <label for="txtZip">
                        Zip:
                        </label>
                        <asp:TextBox ID="txtZip" runat="server" />
                        <asp:RequiredFieldValidator ID="rfvZip" runat="server" 
                            ControlToValidate="txtZip" ErrorMessage="Zip cannot be blank!" Text="*" />
                        <asp:RegularExpressionValidator ID="revZip" runat="server" 
                            ControlToValidate="txtZip" ErrorMessage="Zip has to be 5 digit number!" Text="*" 
                            ValidationExpression="^[0-9]{5}$" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell>
                        <label for="txtStatus">
                        Status:
                        </label>
                        <asp:TextBox ID="txtStatus" runat="server" />
                        <asp:RequiredFieldValidator ID="rfvStatus" runat="server" 
                            ControlToValidate="txtStatus" ErrorMessage="Status cannot be blank!" Text="*" />
                        <asp:RegularExpressionValidator ID="revStatus" runat="server" 
                            ControlToValidate="txtStatus" ErrorMessage="Incorrect Status!" Text="*" 
                            ValidationExpression="^\w\S\D*$" />
                        </asp:TableCell>
                        <asp:TableCell>
                            <label for="txtEnteredBy">Entered By:</label>
                            <asp:TextBox ID="txtEnteredBy" runat="server" Enabled="false" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell>
                        <label for="txtNotes">
                        Notes:
                        </label>
                        <asp:TextBox ID="txtNotes" runat="server" Height="80px" TextMode="MultiLine" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell>
                        <label for="ddlGender">Gender:</label>
                            <asp:DropDownList ID="ddlGender" runat="server" DataSourceID="dsGender" DataTextField="GenderText" DataValueField="GenderID" />
                        </asp:TableCell>
                        <asp:TableCell>
                            <label for="txtEthnicity">Ethnicity:</label>
                            <asp:TextBox ID="txtEthnicity" runat="server" />
                            <asp:RequiredFieldValidator ID="rfvEthnicity" runat="server" 
                                ControlToValidate="txtEthnicity" ErrorMessage="Ethnicity cannot be blank!" Text="*" />
                            <asp:RegularExpressionValidator ID="revEthnicity" runat="server" 
                                ControlToValidate="txtEthnicity" ErrorMessage="Incorrect Ethnicity!" Text="*" 
                                ValidationExpression="^\w\S\D*$" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell>
                        <label for="ddlAgeRange">Age Range:</label>
                            <asp:DropDownList ID="ddlAgeRange" runat="server" DataSourceID="dsAge" DataTextField="Age" DataValueField="AgeID" />
                        </asp:TableCell>
                        <asp:TableCell>
                            <label for="txtCounty">County:</label>
                            <asp:TextBox ID="txtCounty" runat="server" />
                            <asp:RequiredFieldValidator ID="rfvCounty" runat="server" 
                                ControlToValidate="txtCounty" ErrorMessage="County cannot be blank!" Text="*" />
                            <asp:RegularExpressionValidator ID="revCounty" runat="server" 
                                ControlToValidate="txtCounty" ErrorMessage="Incorrect County!" Text="*" 
                                ValidationExpression="^\w\S\D*$" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell>
                            <label for="txtDisability">Disability:</label>
                            <asp:TextBox ID="txtDisability" runat="server" />
                            <asp:RequiredFieldValidator ID="rfvDisability" runat="server" 
                                ControlToValidate="txtDisability" ErrorMessage="Disability cannot be blank!" Text="*" />
                            <asp:RegularExpressionValidator ID="revDisability" runat="server" 
                                ControlToValidate="txtDisability" ErrorMessage="Incorrect Disability!" Text="*" 
                                ValidationExpression="^\w\S\D*$" />
                        </asp:TableCell>
                        <asp:TableCell>
                            <label for="ddlEduLevel">Education Level:</label>
                            <asp:DropDownList ID="ddlEduLevel" runat="server" DataSourceID="dsDegree" DataTextField="EduLvlName" DataValueField="EduID" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell><br />
                        </asp:TableCell>
                        <asp:TableCell><br />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell>
                        <center>
                            <asp:Button ID="btnSave" runat="server" onclick="btnSave_Click" Text="Save" 
                                Width="68px" />
                        </center>
                        </asp:TableCell>
                        <asp:TableCell><asp:Button ID="btnClear" runat="server" CausesValidation="false" 
                            OnClick="btnClear_Click" Text="Clear" Width="68px" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="trMessage" runat="server">
                        <asp:TableCell><asp:Label ID="lblMessage" runat="server" ForeColor="Red"></asp:Label>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableFooterRow ID="trFooter" runat="server">
                        <asp:TableCell><asp:ValidationSummary ID="vsSummary" runat="server" Font-Names="Verdana" 
                            Font-Size="10pt" HeaderText="You have received the following errors:" />
                        </asp:TableCell>
                    </asp:TableFooterRow>
                </asp:Table>
            </div>
       </asp:Panel>
       </asp:Panel>
        <asp:Panel ID="Panel2" runat="server" BackColor="#339966" BorderColor="#CCCCCC" 
        Height="715px" style="margin-right: 13px" Width="175px">
        <center>
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <asp:Button ID="btnVolView" runat="server" BackColor="White" 
                BorderColor="White" BorderStyle="None" Text="View Volunteers" 
                onclick="btnVolView_Click" CausesValidation="False" />
            <br />
            <br />
            <br />
            <asp:Button ID="btnReports" runat="server" BackColor="White" BorderColor="White" 
                BorderStyle="None" Text="Reports" Width="85px" onclick="Button11_Click" 
                CausesValidation="False" Height="22px" />
            <br />
            <br />
            <br />
            <asp:Button ID="btnVolHours" runat="server" BackColor="White" 
                BorderColor="White" BorderStyle="None" onclick="btnVolHours_Click" 
                Text="Volunteer Hours" CausesValidation="False" />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
        </center>
    </asp:Panel>
    <asp:SqlDataSource ID="dsTitle" runat="server" 
        ConnectionString="<%$ ConnectionStrings:VolunteerDBConnectionString %>" 
        SelectCommand="SELECT [Title] FROM [Title]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="dsGender" runat="server" 
        ConnectionString="<%$ ConnectionStrings:VolunteerDBConnectionString %>" 
        SelectCommand="SELECT [GenderID], [GenderText] FROM [Gender]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="dsAge" runat="server" 
        ConnectionString="<%$ ConnectionStrings:VolunteerDBConnectionString %>" 
        SelectCommand="SELECT AgeID, convert(varchar(2), AgeMin) + ' - ' + convert(varchar(2), AgeMax) as Age from AgeRange">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="dsDegree" runat="server" 
        ConnectionString="<%$ ConnectionStrings:VolunteerDBConnectionString %>" 
        SelectCommand="SELECT [EduID], [EduLvlName] FROM [EducationLevel]">
    </asp:SqlDataSource>
    </form>
</body>
</html>
